package com.youth.koodoReaderManager.controller;

import com.youth.koodoReaderManager.entity.Note;
import com.youth.koodoReaderManager.service.NoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/notes")
@Api(tags = "笔记管理") // 定义API的标签，用于Swagger UI中的分类
public class NoteController {

    private final NoteService noteService;

    @Autowired
    public NoteController(NoteService noteService) {
        this.noteService = noteService;
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID获取笔记", notes = "根据提供的ID获取特定笔记的详细信息")
    public Note getNoteById(@PathVariable String id) {
        return noteService.getNoteById(id);
    }

    @GetMapping("listNotes")
    @ApiOperation(value = "获取所有笔记", notes = "获取用户所有笔记的列表")
    public List<Note> listNotes() {
        return noteService.listNotes();
    }

    // 其他API方法，根据需要添加对应的Swagger注解...

}